<?php

namespace App\Http\Controllers\Admin;

use App\Models\SmsTmpl;
use Session;

class SmsTmplController extends BaseController
{

    public function __construct(SmsTmpl $smsTmpl)
    {
        parent::__construct();
        $this->smsTmpl = $smsTmpl;
    }

    public function getIndex()
    {
        $rows = $this->smsTmpl->getAllCache();
        return view('admin.sms.index', compact('rows','type'));
    }

    public function getEdit()
    {
        $res = $this->smsTmpl->getSmsTmplById(request('id'));
        return view('admin.sms.edit',compact('res'));
    }

    public function postEdit()
    {
        $res = $this->smsTmpl->editsmsTmpl(request());
        return redirect()->back()->with('message', $res)->withInput();
    }
}
